package com.huawei.appmarket.service.store.awk.card;

import android.content.Context;
import android.text.TextUtils;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout.LayoutParams;
import com.huawei.appgallery.foundation.card.base.card.BaseDistCard;
import com.huawei.appgallery.foundation.ui.framework.cardkit.bean.CardBean;
import com.huawei.appmarket.service.store.awk.bean.PromoteAppListCardBean;
import huawei.widget.HwTextView;
import o.azb;
import o.cgz;
import o.chy;
import o.eqx;
import o.evx;
import o.ewm.i;
import o.ewm.j;

public class PromoteAppListCard extends BaseDistCard {
    private ImageView ʻ;
    private HwTextView ʼ;
    private View ʽ;
    private ImageView ˋ;
    private HwTextView ᐝ;

    public /* synthetic */ CardBean ˌ() {
        return ˎ();
    }

    public PromoteAppListCard(Context context) {
        super(context);
    }

    public cgz ˏ(View view) {
        this.ˋ = (ImageView) view.findViewById(j.ˋᐝ);
        this.ᐝ = (HwTextView) view.findViewById(j.ʹˋ);
        this.ʼ = (HwTextView) view.findViewById(j.ʹˊ);
        this.ʻ = (ImageView) view.findViewById(j.ˎͺ);
        this.ʽ = view.findViewById(j.ᐧᐝ);
        ʽ(view);
        return this;
    }

    public void ˏ(CardBean cardBean) {
        super.ˏ(cardBean);
        if (cardBean instanceof PromoteAppListCardBean) {
            ((LayoutParams) this.ˋ.getLayoutParams()).setMarginStart(ˊ());
            ((LayoutParams) this.ʻ.getLayoutParams()).setMarginEnd(ˋ());
            PromoteAppListCardBean promoteAppListCardBean = (PromoteAppListCardBean) cardBean;
            ॱ(promoteAppListCardBean);
            this.ᐝ.setText(promoteAppListCardBean.ˊ());
            this.ʼ.setText(this.ʼॱ.getResources().getQuantityString(i.ʼॱ, promoteAppListCardBean.ॱ(), new Object[]{Integer.valueOf(promoteAppListCardBean.ॱ())}));
            this.ʽ.setVisibility(ˊᐝ() ? 0 : 8);
        }
    }

    private void ॱ(PromoteAppListCardBean promoteAppListCardBean) {
        if (TextUtils.isEmpty(promoteAppListCardBean.ॱˑ())) {
            eqx.ˏ(this.ˋ, promoteAppListCardBean.ॱˌ(), "app_default_icon");
        } else {
            eqx.ॱ(this.ˋ, promoteAppListCardBean.ॱˑ(), "app_default_icon");
        }
        this.ˋ.setContentDescription(promoteAppListCardBean.v_());
    }

    public PromoteAppListCardBean ˎ() {
        if (this.ˊᐝ instanceof PromoteAppListCardBean) {
            return (PromoteAppListCardBean) this.ˊᐝ;
        }
        return null;
    }

    public void ॱ(final chy o_chy) {
        this.ˋ.setOnClickListener(new evx(this) {
            final /* synthetic */ PromoteAppListCard ˊ;

            public void ˋ(View view) {
                o_chy.ˏ(0, this.ˊ);
            }
        });
        ˉ().setOnClickListener(new evx(this) {
            final /* synthetic */ PromoteAppListCard ˎ;

            public void ˋ(View view) {
                o_chy.ˏ(0, this.ˎ);
            }
        });
    }

    protected int ˊ() {
        return azb.ˊ(this.ˊˋ.getContext());
    }

    protected int ˋ() {
        return azb.ˏ(this.ˊˋ.getContext());
    }
}
